home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / usr / share / ubiquity / localechooser-apply < prev    next >
Text File  |  2009-07-15  |  2KB  |  59 lines

  1. #! /bin/sh
  2. set -e
  3.  
  4. . /usr/share/debconf/confmodule
  5.  
  6. # We need to duplicate this code because localechooser has the right to
  7. # assume that its later scripts are only run once, but oem-config doesn't
  8. # have that luxury.
  9.  
  10. db_get debian-installer/locale
  11. LOCALE="$RET"
  12.  
  13. db_get debian-installer/language
  14. LANGLIST="$RET"
  15.  
  16. db_get localechooser/supported-locales
  17. EXTRAS="$(echo "$RET" | sed 's/,//g')"
  18.  
  19. if [ -e /etc/environment ]; then
  20.     sed -i "s,^LANG=.*,LANG=\"$LOCALE\"," /etc/environment
  21. fi
  22. if grep -qs "^LANG=" /etc/default/locale; then
  23.     sed -i "s,^LANG=.*,LANG=\"$LOCALE\"," /etc/default/locale
  24. else
  25.     echo "LANG=\"$LOCALE\"" >> /etc/default/locale
  26. fi
  27. # We set LANGUAGE only if the languagelist is a list of
  28. # languages with alternatives. Otherwise, setting it is useless
  29. if echo "$LANGLIST" | grep -q ":"; then
  30.     # Adjust /etc/environment if LANGUAGE is already set, but otherwise
  31.     # leave it alone.
  32.     if grep -q "^LANGUAGE=" /etc/environment; then
  33.         sed -i "s,^LANGUAGE=.*,LANGUAGE=\"$LANGLIST\"," /etc/environment
  34.     fi
  35.     if grep -q "^LANGUAGE=" /etc/default/locale; then
  36.         sed -i "s,^LANGUAGE=.*,LANGUAGE=\"$LANGLIST\"," /etc/default/locale
  37.     else
  38.         echo "LANGUAGE=\"$LANGLIST\"" >> /etc/default/locale
  39.     fi
  40. else
  41.     if [ -e /etc/environment ]; then
  42.         sed -i "/^LANGUAGE=/d" /etc/environment
  43.     fi
  44.     if [ -e /etc/default/locale ]; then
  45.         sed -i "/^LANGUAGE=/d" /etc/default/locale
  46.     fi
  47. fi
  48.  
  49. if [ -e /etc/default/gdm ]; then
  50.     sed -i "s,^#*LANG=.*,LANG=$LOCALE,g" /etc/default/gdm
  51. fi
  52.  
  53. LANGCODE="${LOCALE%%_*}"
  54. LANGCODE="${LANGCODE%%.*}"
  55. LANGCODE="${LANGCODE%%@*}"
  56. /usr/share/locales/install-language-pack "$LANGCODE" '' || true
  57.  
  58. # TODO: kbd/cyr handling?
  59.